import { Component } from 'react';
import { Boxs} from 'saltui';
const { VBox,Box,HBox } = Boxs;
import {loadImg} from 'variables';

export default class PageHome extends Component {
  constructor(props) {
    super(props);

    // let startUserName = decodeURI(this.props.params.startUserName);//创建人用户
    // let startUserGroupName = decodeURI(this.props.params.startUserGroupName);//创建人组织
    //let startUserId = this.props.params.startUserId;
    const token = document.getElementById('token').value;
    this.state={
      loadImg:loadImg+"?token="+token+"&fid=",
      imgUrl:getImagePreUrl()+'/attachment/download?token='+token+'&'
    }
  }

  render() {
    const t = this;
    return (
      <div >
        {
          this.props.list.map(function (item, key) {
            return   <VBox  className="t-PL16 t-P16 t-LH1_5 t-PT0 t-FCa">
              {item.type.indexOf('image') < 0?
            		  <Box>{item.fullMessage}</Box>
            		  :
            		   item.fullMessage==''? <Box>''</Box>
            				   :
        			  <HBox >
            		  <img  width="100%" height="128"  src={t.state.imgUrl+item.fullMessage}/>
					  </HBox>	  
            	  }
              {item.signPic==''|| item.signPic==null?
                ""
                :
                <HBox >
                  <Box flex={1}></Box>
                  <Box ><img className="t-H32 t-W64 " src={t.state.loadImg+item.signPic}/></Box>
                </HBox>
              }
              <Box vAlign="start" hAlign="end" className="t-FAR t-omit" > {item.signPic=='' || item.signPic==null?item.userName:''}&nbsp;{item.time}</Box>
            </VBox>

          })
        }
      </div>
    )
  }
}
